<?php
exit;
include 'common.php';

?>

<html>
<head>
    <title>
        web wechat
    </title>
</head>
<body>
<img src="<?php echo $webWeChat->getQrCode(); ?>" alt="" height="200px">
<script src="//cdn.bootcss.com/jquery/3.0.0/jquery.min.js"></script>
<script type="text/javascript">
    $(function(){
        // 循环请求
        window.setInterval(tryLogin, 3000);
        function tryLogin(){
            $.get('./getLoginStatus.php', function(data) {
                if(data['msg'] == 'success'){
                    window.location.href = "./logined.php";
                } else {
                    console.log('登录失败');
                }
            });
        }
    })
</script>

<?php

    $uuid = $webWeChat->getUUID();
    $status = 400;

    /*
    while ($status > 202 ) {
        $status = $webWeChat->getLoginStatus($uuid);
        file_put_contents('log.txt', json_encode($status) . PHP_EOL, FILE_APPEND);
        sleep(3);
        var_dump($status);
    }
*/






?>
</body>


</html>
